/**
 * Created by mill on 2018/3/25.
 */

(function (w) {

    function emit(name) {
        var event = new Event(name);
        event.args =
        Array.prototype.slice.call(arguments,1);
        w.dispatchEvent(event);
    }
    function on(name, cb) {
        w.addEventListener(name,function (e) {
            cb.apply(w,e.args);
        });
    }

    w.emit=emit;
    w.on=on;
})(window);